# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import hashlib
import itertools
import logging
import os
import re
import time
from openerp import tools
from openerp.osv import fields,osv

_logger = logging.getLogger(__name__)

class document_type_line(osv.osv):
    _name = "document.type.line"
    _description = "Document Type Line"    
    _columns = {
        'name': fields.char('Name', size=128),  
        'parent_id': fields.many2one('document.type', 'Parent'),                 
    }    

document_type_line()

class document_type(osv.osv):
    _name = "document.type"
    _description = "Document Type"    
    _columns = {
        'name': fields.char('Type', size=128),
        'document_line': fields.one2many('document.type.line', 'parent_id', 'Document Type Lines'),                   
    }    

document_type()


class document_order(osv.osv):
    _name = "document.order"
    _description = "Document Order"    
    _columns = {
        'name': fields.char('Name', size=128),
        'portal_byf_id': fields.many2one('portal.byf', 'Portal Byf'),            
        'date' : fields.datetime("Date"),
        'datas': fields.binary('File', nodrop=True),
        'datas_fname': fields.char('File Name',size=256),                  
    }    

document_order()

